package com.ruiyian.bridge.info.controller;

import com.ruiyian.bridge.info.domain.SensorWarningLog;
import com.ruiyian.bridge.info.service.SensorWarningLogService;
import com.ruiyian.common.core.controller.BaseController;
import com.ruiyian.common.core.domain.AjaxResult;
import com.ruiyian.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author chong
 * @email 673426164@qq.com
 * @create 2022/6/17
 * Desc: 预警日志 测点超限
 */
@RestController
@RequestMapping("/bridge/info/warnLog")
public class SensorWarnLogController extends BaseController {
    @Autowired
    private SensorWarningLogService sensorWarningLogService;
    /**
     * 查询预警信息信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(SensorWarningLog SensorWarningLo)
    {
        startPage();
        List<SensorWarningLog> list = sensorWarningLogService.list(SensorWarningLo);
        return getDataTable(list);
    }

    /**
     * 处理
     * @param sensorWarningLog
     * @return
     */
    @PostMapping("/deal")
    public AjaxResult deal(@RequestBody SensorWarningLog sensorWarningLog){
        sensorWarningLogService.deal(sensorWarningLog);
        return AjaxResult.success();
    }

    /**
     * 统计不同报警类型个数
     * @return
     */
    @GetMapping("/countWarnDgree")
    public AjaxResult countWarnDgree(){
        return AjaxResult.success(sensorWarningLogService.countWarnDgree());
    }

    /**
     * 根据传感器类型统计
     * @return
     */
    @GetMapping("/countSensorType")
    public AjaxResult countSensorType(){
        return AjaxResult.success(sensorWarningLogService.countSensorType());
    }
}
